#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;

	ll ans = 0;

	// 锁定为 1
	vector<bool> flag(n);

	int prev0 = k - 1;

	for (int i = 0; i < n; i++) {
		if (s[i] == '1') {
			if (prev0 >= k - 1) {
				ans++;
				flag[i] = true;
			}
			prev0 = 0;
		} else if (s[i] == '0') {
			prev0++;
		}
	}

	cout << ans << endl;

}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t;
	cin >> t;
	while (t-- > 0) {
		solve();
	}
	return 0;
}
